package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.ShoppingCart;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
@Component("shoppingCartService")
public class ShoppingCartServiceImpl implements ServiceTemplateInterface<ShoppingCart> {

	private DaoTemplateInterface<ShoppingCart> shoppingCartDao;
	
	public DaoTemplateInterface<ShoppingCart> getShoppingCartDao() {
		return shoppingCartDao;
	}
	@Resource(name="shoppingCartDao")
	public void setShoppingCartDao(
			DaoTemplateInterface<ShoppingCart> shoppingCartDao) {
		this.shoppingCartDao = shoppingCartDao;
	}

	public void add(ShoppingCart t) throws RunException {
		shoppingCartDao.save(t);		
	}

	public void removeById(long id) throws RunException {
		shoppingCartDao.deleteById(id);
	}

	public void remove(ShoppingCart t) throws RunException {
		shoppingCartDao.delete(t);
	}

	public long update(ShoppingCart t) throws RunException {
		return shoppingCartDao.update(t);
	}

	public ShoppingCart getById(long id) throws RunException {
		return shoppingCartDao.loadById(id);
	}

	public List<ShoppingCart> getAll() throws RunException {
		return shoppingCartDao.loadAll();
	}

}
